# -*- encoding: utf-8 -*-
from shapely.wkt import loads as wkt_loads
import dsl
from . import FixtureTest


# this is a collection of features which have no name and therefore should be
# excluded from being POIs.
class ThePoisWithNoName(FixtureTest):

    def test_trail_riding_station(self):
        # originally from 440-zoos-and-other-attractions-tourism.py
        # unnamed, CO
        self.generate_fixtures(dsl.way(1589837084, wkt_loads('POINT (-104.819282920265 39.61691951649848)'), {u'source': u'openstreetmap.org', u'tourism': u'trail_riding_station'}))  # noqa

        self.assert_no_matching_feature(
            16, 13686, 24901, 'pois',
            {'id': 1589837084})

    def test_kindergarten(self):
        # originally from 526-inclusive-pois.py
        self.generate_fixtures(dsl.way(1460537343, wkt_loads('POINT (-122.483688012197 37.72426009089838)'), {u'source': u'openstreetmap.org', u'amenity': u'kindergarten'}))  # noqa

        self.assert_no_matching_feature(
            16, 10470, 25342, 'pois',
            {'id': 1460537343})

    def test_doctors_clinic(self):
        self.generate_fixtures(dsl.way(3879177193, wkt_loads('POINT (-122.139842296346 47.5815666939138)'), {u'source': u'openstreetmap.org', u'amenity': u'doctors', u'healthcare:speciality': u'general', u'healthcare': u'clinic'}))  # noqa

        self.assert_no_matching_feature(
            16, 10533, 22894, 'pois',
            {'id': 3879177193})

    def test_recreation_track(self):
        # originally from 663-combo-outdoor-landuse-pois.py
        # Cox Stadium recreation track
        self.generate_fixtures(dsl.way(-6328943, wkt_loads('POLYGON ((-122.479315193057 37.72471206116789, -122.479310342155 37.72477565368219, -122.479294891132 37.7248308618878, -122.479276475669 37.72486965681838, -122.479256982227 37.72490525434678, -122.479239644742 37.724928062335, -122.479224642877 37.72494468871451, -122.479194998472 37.7249760940878, -122.479167060867 37.7250001099526, -122.479113790771 37.72503776794969, -122.479086571818 37.7250516232457, -122.479006531926 37.72508579963139, -122.478931612431 37.72510526808519, -122.478851392876 37.72511770231399, -122.478769646185 37.72511770231399, -122.477777726449 37.72508111014898, -122.477673072718 37.72506398643069, -122.477600039685 37.72504416270201, -122.477533833849 37.72501268630471, -122.477473826388 37.72497637829929, -122.477409686677 37.7249156991273, -122.477362435293 37.7248430119507, -122.477328928133 37.72476250886528, -122.477315004246 37.72468207674559, -122.477330275606 37.72460541035939, -122.477349769047 37.7245414624325, -122.477397200094 37.72446820646181, -122.477464124583 37.7244064610723, -122.477530330419 37.72436461060069, -122.477604800756 37.72432595751249, -122.477708735835 37.72430400198098, -122.47783126604 37.7242907149733, -122.478674424765 37.72431878110969, -122.478972036619 37.7243276627962, -122.47926776201 37.7243369708025, -122.479262911108 37.72441861120479, -122.479123492576 37.72441200323819, -122.47915664041 37.7244378666738, -122.479206766403 37.72447900657069, -122.479248627895 37.72453016495968, -122.479285189327 37.72459077339438, -122.479304413274 37.72465230547068, -122.479315193057 37.72471206116789), (-122.479205688424 37.72472698232139, -122.479204969772 37.7246994847648, -122.479201196848 37.7246722003574, -122.479194459483 37.72464527120589, -122.479184937341 37.7246189104702, -122.47917254059 37.72459326025749, -122.479157359062 37.72456860478159, -122.479139572419 37.72454501509658, -122.479119360325 37.7245227043635, -122.479096812612 37.72450188574349, -122.47907201911 37.72448270134439, -122.479045339146 37.72446522222089, -122.479016682888 37.72444959048099, -122.478986589326 37.72443601928589, -122.478943021035 37.72441946384558, -122.478925773382 37.7244113637576, -122.478888583129 37.72440852162121, -122.478825790891 37.72440042153199, -122.477785182465 37.72436965539558, -122.477744129457 37.72437342122819, -122.477700561166 37.72438180553407, -122.477667233669 37.72438827139649, -122.477635433308 37.7243993557307, -122.477604980419 37.7244125716655, -122.477576144499 37.72442791919971, -122.477549015377 37.7244449720117, -122.477523772718 37.7244638722071, -122.477500775846 37.7244844776779, -122.477480114595 37.72450657526249, -122.477461878795 37.72452988074649, -122.477446158277 37.7245544651821, -122.477433312369 37.72457997330179, -122.477423341069 37.7246061919448, -122.477416064715 37.7246331211106, -122.477411842633 37.72466040553228, -122.47741049516 37.72468776099719, -122.477412291791 37.72471525855818, -122.477416873199 37.7247424718967, -122.47742459871 37.72476925890668, -122.477435108999 37.72479547748279, -122.477448404065 37.7248207723604, -122.477464394077 37.72484521459339, -122.477482989204 37.72486837786501, -122.477504009782 37.72489019112329, -122.477527365979 37.72491058331659, -122.477552878133 37.72492927023448, -122.477580276749 37.7249461097724, -122.477609382164 37.7249611019316, -122.477640014716 37.72497396250178, -122.477671186256 37.72498462043129, -122.477704783248 37.724993004668, -122.477738829397 37.72499968363547, -122.477772965378 37.7250030941719, -122.477834769469 37.7250063626025, -122.478817795885 37.72503926005861, -122.478872682948 37.72503528110139, -122.478906459603 37.72502931266519, -122.478939607437 37.72502107053818, -122.478971677293 37.7250105547197, -122.479002489507 37.72499797836729, -122.479031864417 37.72498327042688, -122.479059532527 37.72496671510899, -122.479085224345 37.7249483124121, -122.479108939868 37.7249282044408, -122.479130319772 37.72490660435248, -122.479149184393 37.7248835831988, -122.479165623563 37.7248593541373, -122.479179367786 37.7248342013789, -122.479190327233 37.72480819597569, -122.47919841207 37.72478148003281, -122.479203532468 37.72475426670869, -122.479205688424 37.72472698232139))'), {u'source': u'openstreetmap.org', u'way_area': u'6178.13', u'sport': u'running', u'leisure': u'track'}))  # noqa

        self.assert_no_matching_feature(
            16, 10471, 25342, 'pois',
            {'id': -6328943})

    def test_running_track(self):
        # unnamed running track
        self.generate_fixtures(dsl.way(3643451363, wkt_loads('POINT (-119.780313177696 39.1650791851017)'), {u'source': u'openstreetmap.org', u'sport': u'running', u'leisure': u'track'}))  # noqa

        self.assert_no_matching_feature(
            16, 10962, 25007, 'pois',
            {'id': 3643451363})

    def test_grave_yard(self):
        # Way 79457493 Grave_yard in POIS
        self.generate_fixtures(dsl.way(79457493, wkt_loads('POLYGON ((-122.427218565965 37.76407092205159, -122.426696734616 37.76412460963259, -122.42669224304 37.76409386000428, -122.426550309225 37.76410848915928, -122.426539259947 37.7639710744098, -122.427195569093 37.76385318868478, -122.427218565965 37.76407092205159))'), {u'source': u'openstreetmap.org', u'amenity': u'grave_yard', u'way_area': u'1957.06'}))  # noqa

        self.assert_no_matching_feature(
            15, 5240, 12666, 'pois',
            {'id': 79457493})

    def test_forest(self):
        # Way 64296322 landuse: Forest in POIS
        self.generate_fixtures(dsl.way(64296322, wkt_loads('POLYGON ((-122.640700857616 38.7242680882535, -122.640664026689 38.7278970578343, -122.632756516569 38.72781779742258, -122.631986480708 38.72715427710491, -122.630610441356 38.72595890181019, -122.630615022764 38.72595567804728, -122.62860297619 38.72419246815981, -122.628494998693 38.724097995493, -122.628488710486 38.72410227059409, -122.626538108678 38.72237966446399, -122.625929589905 38.72186586719179, -122.628916488224 38.72072682342749, -122.631626076616 38.72070768969208, -122.631629580045 38.7205389901991, -122.636174965552 38.72058230402468, -122.636124210738 38.72315200043278, -122.636103010497 38.72422519716291, -122.640700857616 38.7242680882535))'), {u'attribution': u'USDA-Forest Service, Pacific Southwest Region', u'description': u'timber production', u'way_area': u'1.07524e+06', u'county': u'Lake', u'source': u'openstreetmap.org', u'landuse': u'forest', u'ID': u'306'}))  # noqa

        self.assert_no_matching_feature(
            10, 163, 392, 'pois',
            {'id': 64296322})

    def test_natural_forest(self):
        # Node:2148541212 natural: Forest in POIS
        self.generate_fixtures(dsl.way(2148541212, wkt_loads('POINT (-93.37909683133499 44.88699480132958)'), {u'source': u'openstreetmap.org', u'natural': u'forest'}))  # noqa

        self.assert_no_matching_feature(
            14, 3942, 5901, 'pois',
            {'id': 2148541212})

    def test_park(self):
        # Node:4206408136 park in POIS
        self.generate_fixtures()  # noqa

        self.assert_no_matching_feature(
            14, 2619, 6333, 'pois',
            {'id': 4206408136})

    def test_protected_area(self):
        # Node:4076680383 protected_area in POIS
        self.generate_fixtures(dsl.way(4076680383, wkt_loads('POINT (-118.260329491154 42.11819268248308)'), {u'source': u'openstreetmap.org', u'boundary': u'protected_area', u'attribution': u'BLM'}))  # noqa

        self.assert_no_matching_feature(
            14, 2809, 6074, 'pois',
            {'id': 4076680383})

    def test_recreation_ground_way(self):
        # Way:86285084 recreation_ground in POIS
        self.generate_fixtures(dsl.way(86285084, wkt_loads('POLYGON ((-122.435618622355 37.75180306929041, -122.435246989322 37.75182267277358, -122.43523216712 37.75164837205669, -122.435603800153 37.75162876852738, -122.435618622355 37.75180306929041))'), {u'way_area': u'1019.77', u'source': u'openstreetmap.org', u'landuse': u'recreation_ground'}))  # noqa

        self.assert_no_matching_feature(
            14, 2619, 6334, 'pois',
            {'id': 86285084})

    def test_recreation_ground_node(self):
        # Node:582131344 recreation_ground in POIS
        self.generate_fixtures(dsl.way(582131344, wkt_loads('POINT (-122.405853933562 37.79615295383658)'), {u'addr:housenumber': u'662', u'source': u'openstreetmap.org', u'landuse': u'recreation_ground', u'description': u'Foot Reflexology', u'addr:street': u'Jackson Street'}))  # noqa

        self.assert_no_matching_feature(
            14, 2621, 6331, 'pois',
            {'id': 582131344})

    def test_village_green(self):
        # Way:28694608 village_green in POIS
        self.generate_fixtures(dsl.way(28694608, wkt_loads('POLYGON ((-122.458529345193 37.7457653045139, -122.458525572269 37.7457788717999, -122.458458827443 37.74583669256149, -122.458399089477 37.74589877524539, -122.458355611017 37.74595901102631, -122.458326685265 37.74602649209048, -122.45831698346 37.74607110059178, -122.458300095132 37.74607898521268, -122.458279164386 37.74607585977748, -122.458171995373 37.7459526180802, -122.458088002894 37.74586297471089, -122.458004459572 37.74578320480688, -122.457917233158 37.74571046708129, -122.457828479608 37.74564106783698, -122.457829108429 37.74562565366638, -122.457845367935 37.7456118732531, -122.458488831173 37.74572311094889, -122.458512995855 37.74573298452938, -122.458527638394 37.74574946417159, -122.458529345193 37.7457653045139))'), {u'way_area': u'2159.11', u'source': u'openstreetmap.org', u'landuse': u'village_green'}))  # noqa

        self.assert_no_matching_feature(
            14, 2618, 6334, 'pois',
            {'id': 28694608})

    def test_water_works(self):
        # Node:3367407023 water_works in POIS
        self.generate_fixtures(dsl.way(3367407023, wkt_loads('POINT (-122.271384759357 37.53560040031699)'), {u'source': u'openstreetmap.org', u'man_made': u'water_works'}))  # noqa

        self.assert_no_matching_feature(
            14, 2627, 6346, 'pois',
            {'id': 3367407023})

    def test_landuse_wood(self):
        # Way:207859675 landuse: wood in POIS
        self.generate_fixtures(dsl.way(207859675, wkt_loads('POLYGON ((-117.89005453116 33.91136551127548, -117.890027671533 33.91175720307361, -117.889979432002 33.9118240007339, -117.889933797586 33.91180841958788, -117.889847469487 33.91179552227351, -117.889797074 33.91180402108199, -117.889737964854 33.91183958187699, -117.889576627429 33.91175772493049, -117.889617321111 33.91172156769318, -117.889649480799 33.9116391887757, -117.889606631159 33.91161481056499, -117.889652175744 33.91149455953338, -117.889550306791 33.91082009198559, -117.88888258904 33.91056646635377, -117.889542221954 33.91055297243508, -117.889633400955 33.9104550109947, -117.889421488379 33.91019899860129, -117.889343784107 33.91020347174229, -117.889270840906 33.9101460664147, -117.889118486634 33.90998756786778, -117.889356630016 33.90954725944538, -117.889737515696 33.90960742363259, -117.889998566118 33.90958871086019, -117.889974131942 33.9113676732641, -117.89005453116 33.91136551127548))'), {u'way_area': u'18306.8', u'source': u'openstreetmap.org', u'landuse': u'wood'}))  # noqa

        self.assert_no_matching_feature(
            14, 2826, 6549, 'pois',
            {'id': 207859675})

    def test_natural_wood(self):
        # Way:372445925 natural: wood in POIS
        self.generate_fixtures(dsl.way(372445925, wkt_loads('POLYGON ((-122.471874717054 37.80816497287509, -122.471767907366 37.80843396000058, -122.471619865007 37.8084786728051, -122.471418822047 37.8082900981427, -122.471322163322 37.80810776862659, -122.471252543888 37.80798910160739, -122.47117744473 37.8076881748186, -122.47112103053 37.80751450259727, -122.471180139676 37.80738305935309, -122.47131147337 37.8075059857635, -122.471560935525 37.80776880060679, -122.471786232998 37.80795311820918, -122.471874717054 37.80816497287509))'), {u'source': u'openstreetmap.org', u'way_area': u'6068.47', u'natural': u'wood'}))  # noqa

        self.assert_no_matching_feature(
            14, 2618, 6330, 'pois',
            {'id': 372445925})

    def test_works(self):
        # Way:164878781 works in POIS
        self.generate_fixtures(dsl.way(164878781, wkt_loads('POLYGON ((-117.16247888899 34.9033516234737, -117.161376386642 34.90333121619139, -117.161374859506 34.9035481077691, -117.159050828034 34.90354589759959, -117.159022261608 34.90128257920438, -117.160153240551 34.9013175745113, -117.160139047169 34.90085666670579, -117.161639772683 34.90083920579339, -117.161661062755 34.9027175955784, -117.162471792299 34.9027128068294, -117.16247888899 34.9033516234737))'), {u'source': u'openstreetmap.org', u'pipeline': u'pumping_station', u'way_area': u'105971', u'man_made': u'works'}))  # noqa

        self.assert_no_matching_feature(
            13, 1429, 3247, 'pois',
            {'id': 164878781})
